<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>View All Tests</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
<body>

<jsp:include page="common/header.jsp"/>

<center><b>The Contents</b></center><br>
<%@page language="java" import="OnlineExam.*, java.util.*"%>
<%
	Category cat = (Category) session.getAttribute ("CATEGORY");
	List<Test> list = cat.retrieveTestsTaken();
%> 
<center>Category : <%= cat.getCategoryId() %></center><br />
<table border = "1" align ="center">
<thead><tr><TH>TestId</TH><TH>Username</TH><TH>Date</TH><TH>MarksScored</TH><TH>MaximumMarks</TH></tr></thead>
<%			 
	for (ListIterator iter = list.listIterator(); iter.hasNext();)
	{
		Test test = (Test) iter.next();
%>
<tr> 
	
     	<td><%= test.getTestId()%></td>
     	<td><%= test.getUsername()%></td>
     	<td><%= test.getDate()%></td>
     	<td><%= test.getMarksScored()%></td>
     	<td><%= test.getMaximumMarks()%></td>
		<td>
		<form>
     		<input type="button" value="View Details" onClick="window.open('http://<%=request.getServerName()%>/OnlineExam/jsp/DisplayAnswerPaper.jsp?testId=<%=test.getTestId()%>','mywindow','width=700,height=800')">
		</form>
		</td>				    
<%
		if (test.underEvaluation())
		{
%>
			<td>
			<form>
    	 		<input type="button" value="Evaluate" onClick="window.open('http://<%=request.getServerName()%>/OnlineExam/jsp/EvaluateAnswerPaper.jsp?testId=<%=test.getTestId()%>','mywindow','width=700,height=800')">
     		</form>
	  		</td>	
<%	
		}
	} 	

%>
</tr>
</table>

<tr><td><br /><br />
<form action="CategoryAdmin.jsp" method="get">
<center><input type="Submit" value= "OK"></center>
</form></td>
<td>
<form action="ViewTests.jsp" method="get">
<center><input type="Submit" value= "Refresh"></center>
</form>
</td></tr>

<jsp:include page="common/footer.jsp"/>

</body>
</html>
